<?php
$v_ip_address = gethostbyaddr($_SERVER['REMOTE_ADDR']);
/*if(isset($_REQUEST['v_session'])){
	$v_session = trim($_REQUEST['v_session']);
}else{
	$v_session= rand(1,999999999).session_id();
}*/
$v_limit = CONST_LIMIT_AF_PAGE ;
if(isset($_REQUEST['page'])){
	$page=$_REQUEST['page'];
}
else
	$page=1;

if(_is_sqlserver()){
	$sql = "Exec ONEGATE_ViewedAFGetAll " ;
	$sql = $sql ."'". $v_ip_address ."'";
	$result = @mssql_query($sql,$conn);	
	$arr_count = _get_row_to_array($result);

	$v_total_af_count = $arr_count['0']['0'];
	
	$pager  = Pager::getPagerData($v_total_af_count, $v_limit, $page);
	$page   = $pager->page;
  	$offset = $pager->offset +1; 
  	$limit = $pager->limit;
	
	
	$sql = "Exec ONEGATE_NextAfGetNByTime " ;
	$sql = $sql ."'". $v_ip_address ."'";
	//$sql = $sql ."'". $v_session ."'";
	$sql = $sql ."," .$offset;
	$sql = $sql .",". $limit;
	
	$result = @mssql_query($sql,$conn);	
	$arr_all_af_by_history = _get_row_to_array($result);
	$count_af=sizeof($arr_all_af_by_history);
}
?>

